package com.test;

import io.netty.buffer.ByteBufAllocator;
import io.netty.channel.ChannelOption;

/**
 * @author wufagang
 * @description
 * @date 2022年06月18日 21:45
 */
public class Demo2 {
    public static void main(String[] args) {
        ChannelOption<Boolean> soKeepalive = ChannelOption.SO_KEEPALIVE;
        System.out.println(soKeepalive.toString());
        System.out.println(isPowerOfTwo(0));
        System.out.println(isPowerOfTwo(1));
        System.out.println(isPowerOfTwo(2));
        System.out.println(isPowerOfTwo(3));
        System.out.println(isPowerOfTwo(4));
        System.out.println(isPowerOfTwo(5));
        System.out.println(isPowerOfTwo(6));
        System.out.println(isPowerOfTwo(7));
        System.out.println(isPowerOfTwo(8));
        System.out.println(isPowerOfTwo(9));
    }
    private static boolean isPowerOfTwo(int val) {
        return (val & -val) == val;
    }
}
